package com.train.order.controller;

import com.train.order.feign.PayOpenFeign;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(path = {"/order"})
public class OrderController {
    @Value(value = "${server.port}")
    private Integer port;

    @Resource
    private PayOpenFeign payOpenFeign;

    @RequestMapping(method = {RequestMethod.GET})
    public String order(){
        return "order-server:"+port;
    }
    @RequestMapping(path = {"/feign"},method = {RequestMethod.GET})
    public String invokeOpenFeign(){
        return payOpenFeign.pay();
    }
}
